var e = require;
var t = module;
var o = exports;
var ii, nn = this && this.__extends || (ii = function (t, e) {
    return (ii = Object.setPrototypeOf || {
        __proto__: []
    }
        instanceof Array &&
        function (t, e) {
            t.__proto__ = e
        } ||
        function (t, e) {
            for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o])
        })(t, e)
},
    function (t, e) {
        function o() {
            this.constructor = t
        }
        ii(t, e),
            t.prototype = null === e ? Object.create(e) : (o.prototype = e.prototype, new o)
    }
),
    rr = this && this.__awaiter ||
        function (t, e, o, i) {
            return new (o || (o = Promise))(function (n, a) {
                function r(t) {
                    try {
                        l(i.next(t))
                    } catch (e) {
                        a(e)
                    }
                }
                function s(t) {
                    try {
                        l(i.
                            throw(t))
                    } catch (e) {
                        a(e)
                    }
                }
                function l(t) {
                    var e;
                    t.done ? n(t.value) : (e = t.value, e instanceof o ? e : new o(function (t) {
                        t(e)
                    })).then(r, s)
                }
                l((i = i.apply(t, e || [])).next())
            })
        };
var oo = (this && this.__decorate) ||
    function (e, t, a, n) {
        var i,
            o = arguments.length,
            s = o < 3 ? t : null === n ? (n = Object.getOwnPropertyDescriptor(t, a)) : n;
        if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) s = Reflect.decorate(e, t, a, n);
        else
            for (var r = e.length - 1; r >= 0; r--)
                (i = e[r]) && (s = (o < 3 ? i(s) : o > 3 ? i(t, a, s) : i(t, a)) || s);
        return o > 3 && s && Object.defineProperty(t, a, s), s;
    };
Object.defineProperty(o, "__esModule", { value: !0 });
var a = e("BaseModuleUI"),
    n = e("NotifyEventType"),
    i = e("GlobalParams"),
    r = e("AssetsManager"),
    s = e("AudioManager"),
    l = e("RoleSoldierInfo"),
    _ = e("AD"),
    c = cc._decorator,
    d = c.ccclass,
    h = c.property,
    u = (function (e) {
        function t() {
            var t = (null !== e && e.apply(this, arguments)) || this;
            return (
                (t.kill_info_node = null),
                (t.kill_name = null),
                (t.be_kill_name = null),
                (t.kill_head = null),
                (t.be_kill_head = null),
                (t.kill_bg = []),
                (t.be_kill_bg = []),
                (t.kill_info_list = []),
                (t.show_kill_tip = !1),
                (t.rest_name = [
                    "士兵",
                    "士兵",
                    "超级兵",
                    "防御塔",
                    "烈焰犬",
                    "雷电龙狐",
                    "毒液蜘蛛",
                    "机械邪瑞",
                    "冰山巨兽"
                ]),
                (t.is_first = !0),
                (t.my_kill = 0),
                t
            );
        }
        return (
            nn(t, e),
            (t.prototype.initView = function () {
                (this.is_first = !0),
                    (this.my_kill = 0),
                    (this.kill_info_node.active = !1),
                    (this.show_kill_tip = !1),
                    (this.kill_info_list = []);
            }),
            (t.prototype.addEvent = function () {
                this.attachEvent(n.default.SEND_ROLE_BE_KILL_INFO, this.showKillTipInfo, this);
            }),
            (t.prototype.showKillTipInfo = function (e, t) {
                if (!(t.kill < 0) && -1 == [11, 12, 13].indexOf(t.be_kill)) {
                    var o = {
                        kill_name: "",
                        kill_head: "",
                        kill_id: 0,
                        is_red_ream: !1,
                        be_kill_name: "",
                        be_kill_head: "",
                        be_kill_id: 0
                    };
                    t.kill < 11
                        ? ((o.kill_name = i.GlobalParams.MatchGamePlayer[t.kill].name),
                            (o.kill_head =
                                "hero_" + l.default.Role_info[i.GlobalParams.MatchGamePlayer[t.kill].role_id].id))
                        : ((o.kill_name = this.rest_name[t.kill - 11]), (o.kill_head = t.kill)),
                        (o.kill_id = t.kill),
                        (o.is_red_ream = t.be_kill % 2 != i.GlobalParams.MatchMyIndex % 2),
                        t.be_kill < 11
                            ? ((o.be_kill_name = i.GlobalParams.MatchGamePlayer[t.be_kill].name),
                                (o.be_kill_head =
                                    "hero_" + l.default.Role_info[i.GlobalParams.MatchGamePlayer[t.be_kill].role_id].id))
                            : ((o.be_kill_name = this.rest_name[t.be_kill - 11]), (o.be_kill_head = t.be_kill)),
                        (o.be_kill_id = t.be_kill),
                        this.show_kill_tip
                            ? this.kill_info_list.push(o)
                            : ((this.show_kill_tip = !0), this.showKillInfo(o));
                }
            }),
            (t.prototype.showKillListInfo = function () {
                this.kill_info_list.length > 0
                    ? (this.showKillInfo(this.kill_info_list[0]), this.kill_info_list.splice(0, 1))
                    : (this.show_kill_tip = !1);
            }),
            (t.prototype.showKillInfo = function (e) {
                var t = this;
                if (
                    ((this.kill_name.string = "" + e.kill_name),
                        (this.be_kill_name.string = "" + e.be_kill_name),
                        (this.kill_head.spriteFrame = r.default.getInstance().getGameHoreHeadFrame(e.kill_head)),
                        (this.be_kill_head.spriteFrame = r.default.getInstance().getGameHoreHeadFrame(e.be_kill_head)),
                        (this.kill_bg[0].active = this.be_kill_bg[1].active = e.is_red_ream),
                        (this.kill_bg[1].active = this.be_kill_bg[0].active = !e.is_red_ream),
                        (this.kill_info_node.active = !0),
                        e.kill_id < 11 && e.be_kill_id < 11)
                )
                    if (
                        (e.be_kill_id != i.GlobalParams.MatchMyIndex ||
                            this.is_first ||
                            (this.my_kill > 2
                                ? s.default.getInstance().playFx("finality")
                                : s.default.getInstance().playFx("killYou"),
                                i.GlobalParams.gameShock.value && _.default.getInstance().vibrateShort()),
                            e.kill_id == i.GlobalParams.MatchMyIndex
                                ? (this.my_kill++, i.GlobalParams.gameShock.value && _.default.getInstance().vibrateShort())
                                : (this.my_kill = 0),
                            this.is_first)
                    )
                        (this.is_first = !1), s.default.getInstance().playFx("fristBlood");
                    else if (this.my_kill > 0) {
                        var o = "";
                        1 == this.my_kill && (o = "killEnemy"),
                            2 == this.my_kill && (o = "doubleKill"),
                            3 == this.my_kill && (o = "tripleKill"),
                            4 == this.my_kill && (o = "fourKill"),
                            5 == this.my_kill && (o = "fiveKill"),
                            6 == this.my_kill && (o = "sixKill"),
                            this.my_kill > 6 && (o = "sevenKill"),
                            s.default.getInstance().playFx(o);
                    }
                this.scheduleOnce(function () {
                    (t.kill_info_node.active = !1),
                        t.scheduleOnce(function () {
                            t.showKillListInfo();
                        }, 0.5);
                }, 2);
            }),
            oo([h(cc.Node)], t.prototype, "kill_info_node", void 0),
            oo([h(cc.Label)], t.prototype, "kill_name", void 0),
            oo([h(cc.Label)], t.prototype, "be_kill_name", void 0),
            oo([h(cc.Sprite)], t.prototype, "kill_head", void 0),
            oo([h(cc.Sprite)], t.prototype, "be_kill_head", void 0),
            oo([h(cc.Node)], t.prototype, "kill_bg", void 0),
            oo([h(cc.Node)], t.prototype, "be_kill_bg", void 0),
            oo([d], t)
        );
    })(a.default);
o.default = u;
